<template>
	<div style="width: 33%;">
		<el-form :model="hot">
			<el-form-item label="类型">
				<el-input v-model="hot.type"></el-input>
			</el-form-item>
			<el-form-item label="热度">
				<el-input v-model="hot.hot"></el-input>
			</el-form-item>
			<el-form-item label="描述">
				<el-input v-model="hot.memo" placeholder="请输入信息"></el-input>
			</el-form-item>
			<el-form-item>
				<el-upload class="upload-demo" action="/uploadUrl" :on-change="handleChange"
					:before-upload="handleBeforeUpload" :file-list="fileList" :auto-upload="false" :multiple="false"
					:limit="1">
					<el-button type="primary">点击上传</el-button>
				</el-upload>
			</el-form-item>
			<el-form-item><el-button @click="add()">添加</el-button></el-form-item>
		</el-form>
	</div>
</template>

<script>
	export default {
		name: "addPic",
		data() {
			return {
				fileList: [],
				hots: [],
				hot: {},
			}
		},
		methods: {
			handleChange(file, fileList) {
				this.fileList = fileList;
			},
			handleBeforeUpload(file) {
				// 在这里可以对文件进行检查和限制
			},
			add() {
				let _this = this;
				let token = window.localStorage.getItem("token")
				this.$postKv("/api/adm/hot/add", this.hot).then((resp) => {
					_this.hots = resp.data.data;
				})
			},
		}
	}
</script>

<style>
</style>